package com.ouyeel.wlxer.util;

import com.ouyeel.wlxer.R;
import com.ouyeel.wlxer.bean.MenuItem;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by rankaifeng on 2017/11/16.
 */

public class MenuItemFactory {
    public static final int TAG_TASK = 1;//我的任务
    public static final int TAG_OFFER = 2;//我的报价
    public static final int TAG_RECORD = 3;//执行记录
    private static MenuItemFactory instanse;
    private static final int TAGNUMBER[] =
            new int[]{TAG_TASK, TAG_OFFER, TAG_RECORD};
    private static final int IMG_ITEM[] =
            new int[]{R.drawable.mytask, R.drawable.baojia, R.drawable.jilu};
    private static final int BACKGROUND_COLOR[] = new int[]{R.drawable.main_task
            , R.drawable.main_baojia, R.drawable.main_jilu};
    private static final String ITEM_TITLES[] = new String[]{"我的任务", "我的报价", "执行记录"};
    private List<MenuItem> menuItemList = new ArrayList<>();
    private MenuItem menuItem;

    public static MenuItemFactory getInstanse() {
        if (instanse == null) {
            instanse = new MenuItemFactory();
        }
        return instanse;
    }

    public List<MenuItem> setMenuItems() {
        for (int i = 0; i < IMG_ITEM.length; i++) {
            menuItem = new MenuItem();
            menuItem.setBackgroundColor(BACKGROUND_COLOR[i]);
            menuItem.setImgId(IMG_ITEM[i]);
            menuItem.setStrTitle(ITEM_TITLES[i]);
            menuItem.setTag(TAGNUMBER[i]);
            menuItemList.add(menuItem);
        }
        return menuItemList;
    }
}
